Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvements to data resolution #623

Merged
merged 6 commits into from
Jan 11, 2021
Merged

improvements to data resolution #623

merged 6 commits into from
Jan 11, 2021

Conversation

dbarrosop
Copy link
Contributor

@dbarrosop dbarrosop commented Dec 21, 2020

fixes #621

When resolving data nornir would start climbing up the tree until reach the defaults, however, the desired behaviour was to climb the tree and then back down for the next group before checking reaching the defaults, which should be checked only as a last resort.

For instance, with the tree below:

         host
     g1       g2
  g11 g12
        defaults

Before the behaviour was host -> g1 -> g11 -> defaults and now it is host -> g1 -> g11 -> g12 -> g2 -> defaults

In addition, this introduces two new methods:

  1. extended_data, which returns the data of a given host or group, including its inherited data
  2. extended_groups, which includes a list of groups the host or group belongs to including its inherited groups

Finally, the dict method was resolving the attributes of the hosts and groups, which wasn't supposed to happen, it's been fixed

@dbarrosop dbarrosop mentioned this pull request Dec 21, 2020
@dbarrosop dbarrosop changed the title prefer data from groups instead of defaults when resolving data improvements to data resolution Dec 27, 2020
@dbarrosop
Copy link
Contributor Author

dbarrosop commented Dec 27, 2020

@no-such-anthony would you mind taking a look? And thanks for the pointers/comments

@no-such-anthony
Copy link

@dbarrosop Perfect, and the scenarios I had are all returning the correct inherited values.

@dbarrosop dbarrosop merged commit 1494e1d into develop Jan 11, 2021
@dbarrosop dbarrosop deleted the fix_621 branch January 11, 2021 08:29
@dbarrosop dbarrosop mentioned this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inheritance Issue
2 participants